﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Entity.TEST.UserBases>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Index
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        $(function () {
            $("#delAll").click(function () {
                confirmDialog(function () {
                    var ids = '';
                    $(".liebiao_table").find("tbody").find("input[type=checkbox][checked=true]").each(function (i, o) { ids += $(o).val() + ","; });
                    $.ajax({
                        type: "POST",
                        url: "/Home/DelMore",
                        data: { idArr: ids },
                        dataType: "Json",
                        success: function (json) {
                            if (json.success = true) {
                                alertDialog('操作成功'); ;
                                location.href = location.href;
                            }
                            else
                                alertDialog('操作失败');
                        }
                    });
                });
            });

        });
      
    </script>
    <h2>
        用户列表</h2>
    <table class="chaxun_table" cellspacing="1" cellpadding="3" width="100%">
        <tr>
            <td>
                查询条件区
            </td>
        </tr>
    </table>
    <table class="liebiao_table" cellspacing="1" cellpadding="3" width="100%">
        <thead>
            <tr>
                <th>
                    <input type="checkbox" />
                    <input type="button" id="delAll" value="删除" />
                </th>
                <th>
                    编号
                </th>
                <th>
                    用户名
                </th>
                <th>
                    建立日期
                </th>
                <th>
                    更新日期
                </th>
                <th>
                    状态
                </th>
                <th>
                    电子邮件
                </th>
            </tr>
        </thead>
        <tbody>
            <%
      
                foreach (var item in Model)
                { %>
            <tr>
                <td>
                    <input type="checkbox" value="<%=item.UserID %>" />
                    <%: Html.ActionLink("编辑", "Edit", new { id=item.UserID }) %>
                    |
                    <%=Html.ActionLinkForViewFillToDialog("详细","details","Home" ,"id",item.UserID)%>
                    |
                    <%: Html.ActionLinkForConfirm("删除", "Delete", new { id = item.UserID })%>
                </td>
                <td>
                    <%: item.UserID %>
                </td>
                <td>
                    <%: item.Name %>
                </td>
                <td>
                    <%: String.Format("{0:g}", item.CreateDate) %>
                </td>
                <td>
                    <%: String.Format("{0:g}", item.UpdateDate) %>
                </td>
                <td>
                    <%: ((Entity.CommonEnums.Status)item.Status).GetDescription()%>
                </td>
                <td>
                    <%: item.Email %>
                </td>
            </tr>
            <% } %>
        </tbody>
        <tfoot>
            <tr>
                <td colspan="7">
                </td>
            </tr>
        </tfoot>
    </table>
    <p>
        <%: Html.ActionLink("添加", "Create") %>
    </p>
</asp:Content>
